<template>
    <view class="success">
        <image :src="BaseUrl + '/static/wImg/radius.png'" mode="aspectFill"></image>
        <text class="dingdan">{{ msg }}</text>
        <view class="success-text" @click="backMy"> 用户中心 </view>
        <view class="success-btn" @click="backHome"> 返回首页 </view>
    </view>
</template>
<script>
import { BaseUrl } from "@/utils/req.js";

export default {
    name: "success",
    components: {},
    mixins: [],
    props: {},
    data() {
        return {
            BaseUrl,
            msg: "支付已成功",
        };
    },
    computed: {},
    watch: {},
    onLoad(options) {
        if (options.type == "withdraw") {
            this.msg = "提现成功,请等待审核";
        }   else if (options.type == "recharge") {
            this.msg = "充值成功";
        }
    },
    onBackPress({ from }) {
        // 用户触发返回
        if (from == "backbutton") {
            uni.navigateTo({
                url: "/pages/tabBar/mine/mine",
            });
            return false;
        }
    },
    methods: {
        //返回首页
        backHome() {
            uni.reLaunch({
                url: "/pages/tabBar/home/home",
            });
        },
        //点击返回用户中心
        backMy() {
            uni.reLaunch({
                url: "/pages/tabBar/mine/mine",
            });
        },
    },
};
</script>
<style lang="scss" scoped>
.success {
    width: 100%;
    margin: 0 auto;
    text-align: center;
    margin-top: 40rpx;
    image {
        width: 120rpx;
        height: 120rpx;
        border-radius: 50%;
        margin: 20rpx auto;
    }
    .dingdan {
        color: #333;
        font-size: 30rpx;
        padding-top: 20rpx;
    }
    .success-text {
        color: #fff;
        text-align: center;
        font-size: 28rpx;
        border-radius: 10rpx;
        margin: 100rpx 40rpx 0;
        padding: 20rpx 0;
        background: linear-gradient(to right, #ff7f23, #ff494f);
    }
    .success-btn {
        border-radius: 10rpx;
        text-align: center;
        font-size: 28rpx;
        margin: 40rpx 40rpx;
        padding: 20rpx 0;
        border: 1px solid #b3b3b3;
        color: #b3b3b3;
    }
}
</style>
